package design_pattern

import (
	"fmt"
	"net/http"
)

type HomePlanetRenderApp struct {
	NameAPI   *NameAPI   `inject:""`
	PlanetAPI *PlanetAPI `inject:""`
}

func (a *HomePlanetRenderApp) Render(id uint64) string {
	return fmt.Sprintf("%s is from the planet %s.", a.NameAPI.Name(id), a.PlanetAPI.Planet(id))
}

type NameAPI struct {
	HTTPTransport http.RoundTripper `inject:""`
}

func (n *NameAPI) Name(id uint64) string {
	return "Spock"
}

type PlanetAPI struct {
	HTTPTransport http.RoundTripper `inject:""`
}

func (p *PlanetAPI) Planet(id uint64) string {
	return "Vulcan"
}
